<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Dashboard">
    <meta name="keyword" content="Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">

    <!-- Bootstrap core CSS -->
    <link href="assets/css/bootstrap.css" rel="stylesheet">
    <!--external css-->
    <link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
        
    <!-- Custom styles for this template -->
    <link href="assets/css/style.css" rel="stylesheet">
    <link href="assets/css/style-responsive.css" rel="stylesheet">

  </head>

  <body>

      <!-- **********************************************************************************************************************************************************
      MAIN CONTENT
      *********************************************************************************************************************************************************** -->

	  <div id="login-page">
	  	<div class="container">
	  	
		      <div class="form-login">
		        <h2 class="form-login-heading">sign in now</h2>
		        <div class="login-wrap">
		            <input type="text" class="form-control" placeholder="User ID" autofocus v-model="name">
		            <br>
		            <input type="password" class="form-control" placeholder="Password" v-model="pwd">
					<br>	
		            <button class="btn btn-theme btn-block" v-on:click="login()"><i class="fa fa-lock"></i> SIGN IN</button>
		            <hr>
		
		        </div>
		
		      </div>	  	
	  	
	  	</div>
	  </div>

    <!-- js placed at the end of the document so the pages load faster -->
    <script src="assets/js/jquery.js"></script>
    <script src="assets/js/bootstrap.min.js"></script>

    <script type="text/javascript" src="assets/js/jquery.backstretch.min.js"></script>
    <script>
        $.backstretch("assets/img/home.jpg", {speed: 500});
    </script>
	<script src="assets/js/const.js"></script>
	<script src="assets/js/axios.min.js"></script>
	<script src="assets/js/vue.js"></script>
	<script>
		config = {
			"el" : ".form-login" ,
			"data" : {
				"name" : "",
				"pwd" : ""
			},
			"methods" : {
				"login" : function(){
					var u = url + "/admin/adminLogin?password="+this.pwd+"&userName=" + this.name;
					console.log(u) ;
					axios.get(u)
					.then(function(response){
						console.log(response) ;
						if(response.data.state == "0") {
							window.alert("登录成功！") ;
							window.sessionStorage.setItem("id" ,response.data.data) ;
							window.sessionStorage.setItem("name" , this.vue.name) ;
							
							window.location.href = "index.html" ;
						}else{
							window.alert("登录失败！") ;
						}
					})
					.catch() ;
				}
			}
		}
		
		var vue = new Vue(config) ;
	</script>

  </body>
</html>
